package test

import (
	"net/http"

	"awfan.cn/utils"
	"gopkg.in/mgo.v2"
)

func all(format string, w http.ResponseWriter, db *mgo.Database) {
	c := db.C(utils.PkgName(TEST_XML{}))

	v := TESTS_XML{}

	err := c.Find(nil).All(&v.Tests)

	if err != nil {
		utils.WriteError(format, 404, err.Error(), w)
		return
	}

	utils.WriteData(format, v, w)
}
